<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      /* 
            dajsdh13715678903jasdlakdkjg13457890657djashdjka13811678908sdadadasd
            获取手机号
            1   3到9之间 任意9位数字
            比如我们想隐藏前两位后的四位数字
            1   3到9之间   任意四位数字  任意五位数字
        */
      let str = 'dajsdh13715678903jasdlakdkjg13457890657djashdjka13811678908sdadadasd';

      let reg = /(1[3-9])\d{4}(\d{5})/gi;

      let result;
      console.log(result);
      while ((result = reg.exec(str))) {
        console.log(result[1]+"****"+result[2]);
      }
    </script>
  </head>
  <body></body>
</html>
